package kevin.workplan.web.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import kevin.workplan.web.controller.base.BaseJsonController;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/work")
public class HomeController extends BaseJsonController {

	
	@RequestMapping("index")
	public String login(HttpServletRequest request,
			HttpServletResponse response, HttpSession session){
		return "work/index";
	}
	
	
	@RequestMapping("nav")
	@ResponseBody
	public Map<String,Object> nav(HttpServletRequest request,
			HttpServletResponse response, HttpSession session){
		
		Map<String,Object> node1 = new HashMap<String,Object>();
		node1.put("id","1");
		node1.put("text","任务管理");
		node1.put("url","/work/plan/list");
		Map<String,Object> node2 = new HashMap<String,Object>();
		node2.put("id","2");
		node2.put("text","新建任务");
		node2.put("url","/work/plan/add");
		
		List<Map> navTree = new ArrayList<Map>();
		navTree.add(node1);
		navTree.add(node2);
		return successResult(navTree);
	}
	
}
